package com.zhs.demoutil.controller;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhs.demoutil.entity.ExportCheckResult;
import com.zhs.demoutil.entity.TableRecord;
import com.zhs.demoutil.entity.TableRecord;
import com.zhs.demoutil.entity.TmpCheckResult;
import com.zhs.demoutil.model.Result;
import com.zhs.demoutil.service.TableRecordService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("table_record")
public class TableRecordController {
    
    @Autowired
    private TableRecordService tableRecordService;

    @PostMapping("list/by_page")
    @ApiOperation(value = "分页查询所有上传记录",tags = "查询")
    public Result<Page<TableRecord>> list(@RequestParam Integer current, @RequestParam Integer size){
        Page<TableRecord> tablePage = new Page<>(current, size);
        QueryWrapper<TableRecord> tableRecordQueryWrapper = new QueryWrapper<>();
        tableRecordQueryWrapper.orderByDesc("id");
        Page<TableRecord> page = tableRecordService.page(tablePage,tableRecordQueryWrapper);
        return Result.success(page);
    }

    @PostMapping("list/by_table_id")
    @ApiOperation(value = "根据上传记录的id分页查询对比结果数据",tags = "查询")
    public Result<Page<ExportCheckResult>> list(@RequestParam Long tableId,@RequestParam Integer current, @RequestParam Integer size,String street){
        Page<ExportCheckResult> page = tableRecordService.pageNoCheckResult(tableId,current,size,street);
        return Result.success(page);
    }





}
